home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / CSMP Digests / csmp-v1-025.txt < prev    next >
Encoding:
Text File  |  1992-11-18  |  43.3 KB  |  1,239 lines  |  [TEXT/MPS ]

  1. C.S.M.P. Digest             Fri, 20 Mar 92       Volume 1 : Issue 25
  2.  
  3. Today's Topics:
  4.  
  5.     THINK C 5.0
  6.     Programming in more than one language
  7.     Dropping Aliases on Applications
  8.     Searching though a folder within the system folder
  9.     Hellcats of the Pacific and Fast Graphics
  10.     Think C 4.0 Debugger and System 7
  11.     Asynchronious Sound Recording
  12.     Temporary file name suggestion
  13.     PICT <-> Raw
  14.     Detecting color hardware
  15.     Floating point registers contents to main memory?
  16.     TN #120 and Non-32 Bit QD
  17.     NBP LookUp Problem
  18.  
  19.  
  20. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  21.  
  22. These digests are available (by using FTP, account anonymous, your email
  23. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  24. edu (try skinner.cs.uoregon.edu if that doesn't work).  This is also the home
  25. of the comp.sys.mac.programmer Frequently Asked Questions list.
  26.  
  27. These digests are also available via email.  Just send a note saying that you
  28. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  29. automatically receive each new digest as it is created.
  30.  
  31. The articles in these digests are taken directly from comp.sys.mac.programmer.
  32. They are not edited; all articles included in this digest are in their original
  33. posted form.  The only articles that are -not- included in these digests are
  34. those which didn't receive any replies (except those that give information
  35. rather than ask a question).  All replies to each article are concatenated
  36. onto the original article in the order in which they were received.  Article
  37. threads are not added to the digests until the last article added to the
  38. thread is at least one month old (this is to ensure that the thread is dead
  39. before adding it to the digests).
  40.  
  41. Send administrative mail to mkelly@cs.uoregon.edu.
  42.  
  43. -------------------------------------------------------
  44.  
  45. From: mgilbert@rodan.acs.syr.edu (Michael W. Gilbert)
  46. Subject: THINK C 5.0
  47. Organization: Syracuse University, Syracuse, NY
  48. Date: Sat, 15 Feb 92 17:42:41 EST
  49.  
  50. I'm sure that this has been discussed to some extent, but I haven't
  51. been able to keep up with this group over the past few months.
  52.  
  53. With the upgrade to THINK C 5.0, has the language come more into step
  54. with the C++ "standard"?  Is it worth the $70 (or whatever) for me
  55. to upgrade from 4.0 to 5.0 so that I can use this instead of
  56. Turbo C++ for a class I'm taking?
  57.  
  58. Thanks!  e-mail responses, please.
  59.  
  60. /-----------------------------------------------------------------------------\
  61. | Mike W. Gilbert          | Quick to Judge, Quick to Anger, Slow to          |
  62. | Software Engineer        |   Understand, Ignorance and Prejudice, and Fear, |
  63. | GE O&RSD, Syracuse, NY   |   walk hand-in-hand."     Peart, 1981            |
  64. \-----------------------------------------------------------------------------/
  65.  
  66.  
  67.  
  68. - -------------------------
  69.  
  70. From: ksand@apple.com (Kent Sandvik)
  71. Subject:  THINK C 5.0
  72. Date: 17 Feb 92 05:46:48 GMT
  73. Organization: MacDTS Mongols
  74.  
  75. In article <1992Feb15.174241.4599@newstand.syr.edu>, mgilbert@rodan.acs.syr.edu (Michael W. Gilbert) writes:
  76. > I'm sure that this has been discussed to some extent, but I haven't
  77. > been able to keep up with this group over the past few months.
  78. > With the upgrade to THINK C 5.0, has the language come more into step
  79. > with the C++ "standard"?  Is it worth the $70 (or whatever) for me
  80. > to upgrade from 4.0 to 5.0 so that I can use this instead of
  81. > Turbo C++ for a class I'm taking?
  82.  
  83. The Think C 5.0 object extensions don't fully conform to the current C++
  84. standard. However I would gladly pay $70 for a nice C development environment
  85. upgrade that works fine on a portable!
  86.  
  87. Kent Sandvik
  88. - --
  89. speaking on behalf of all those hackers who have died of a caffein overdose
  90.  
  91.  
  92.  
  93. ---------------------------
  94.  
  95. From: jdt@kepler.unh.edu (Jay D Thomas)
  96. Subject: Programming in more than one language
  97. Date: 16 Feb 92 05:52:21 GMT
  98. Organization: University of New Hampshire  -  Durham, NH
  99.  
  100. In a Macintosh environment, is it possible to write a program in more than one
  101. language?  In other words you wrote a free standing set of subroutines
  102. in one language, compiled them, and then load them from another language
  103. in order to call them?  Is there some kind of standard format that
  104. creators of compilers are encouraged to use so that they are compatible
  105. with each other?
  106.  
  107.  
  108.  
  109. - -------------------------
  110.  
  111. From: peirce@outpost.SF-Bay.org (Michael Peirce)
  112. Subject:  Programming in more than one language
  113. Date: 16 Feb 92 23:40:59 GMT
  114. Organization: Peirce Software
  115.  
  116.  
  117. In article <1992Feb16.055221.23279@nic.unh.edu> (comp.sys.mac.programmer), jdt@kepler.unh.edu (Jay D Thomas) writes:
  118. > In a Macintosh environment, is it possible to write a program in more than one
  119. > language?  In other words you wrote a free standing set of subroutines
  120. > in one language, compiled them, and then load them from another language
  121. > in order to call them?  Is there some kind of standard format that
  122. > creators of compilers are encouraged to use so that they are compatible
  123. > with each other?
  124.  
  125. Sure.  MPW linker will link any of a number of languages together
  126. into a single program.  I very often link MPW Pascal and MPW C together.
  127. Other options include Fortran and Modula 2.  There are others.
  128.  
  129. Calling between MPW C and MPW Pascal is easy.  C provides a "pascal"
  130. keyword that is used to indicate that a given function should us Pascal
  131. calling conventions.  Likewise, Pascal provides a way to do the same
  132. thing for C called from Pascal.  Toolbox calls always use Pascal calling
  133. conventions (though there are a couple of hidden jems that use C calling
  134. conventions (see the transition queue stuff in AppleTalk for example)).
  135.  
  136. The THINK environments (THINK C and THINK Pascal) can't directly use
  137. code from each other, but you can bring MPW objects (.o files) into a
  138. Think project by running it through a converter.
  139.  
  140. --  Michael Peirce         --   peirce@outpost.SF-Bay.org
  141. --  Peirce Software        --   Suite 301, 719 Hibiscus Place
  142. --  Macintosh Programming  --   San Jose, California USA 95117
  143. --           & Consulting  --   voice: (408) 244-6554 fax: (408) 244-6882
  144. --                         --   AppleLink: peirce & America Online: AFC Peirce
  145.  
  146.  
  147.  
  148. - -------------------------
  149.  
  150. From: siegel@world.std.com (Rich Siegel)
  151. Subject:  Programming in more than one language
  152. Date: 17 Feb 92 03:59:03 GMT
  153. Organization: Symantec Language Products Group
  154.  
  155. In article <D2150035.s8dkbp@outpost.SF-Bay.org> peirce@outpost.SF-Bay.org (Michael Peirce) writes:
  156. >
  157. >The THINK environments (THINK C and THINK Pascal) can't directly use
  158. >code from each other, but you can bring MPW objects (.o files) into a
  159. >Think project by running it through a converter.
  160.  
  161. For the record, THINK Pascal can load both THINK C libraries and .O files
  162. without an external converter. THINK Pascal produces .O-format files as
  163. libraries, so a THINK Pascal-produced library can be loaded into THINK C
  164. using oconv (the converter supplied with THINK C).
  165.  
  166. R.
  167.  
  168. -- 
  169. - ---------------------------------------------------------------------
  170. Rich Siegel                              Internet: siegel@world.std.com
  171. Senior Software Engineer                 Applelink: SIEGEL
  172. Symantec Languages Group
  173.  
  174.  
  175.  
  176. - -------------------------
  177.  
  178. From: ksand@apple.com (Kent Sandvik)
  179. Subject:  Programming in more than one language
  180. Date: 17 Feb 92 03:05:34 GMT
  181. Organization: MacDTS Mongols
  182.  
  183. In article <1992Feb16.055221.23279@nic.unh.edu>, jdt@kepler.unh.edu (Jay D Thomas) writes:
  184. > In a Macintosh environment, is it possible to write a program in more than one
  185. > language?  In other words you wrote a free standing set of subroutines
  186. > in one language, compiled them, and then load them from another language
  187. > in order to call them?  Is there some kind of standard format that
  188. > creators of compilers are encouraged to use so that they are compatible
  189. > with each other?
  190.  
  191. Yes, the object file format is the key to inter-language linking. MPW has such
  192. features (i.e. linker that resolves OMF files), and this is one of the reasons 
  193. people use MPW instead of Think (I had to think of at least one reason :-) ). 
  194.  
  195. Otherwise Apple Events and the Object library will make it possible to have loosely 
  196. connected applications sending AE messages back and forth. This is the future model 
  197. Apple would like to have on user desktops, instead of huge 1400k applications with 
  198. every possible feature ever invented since the primitive man discovered the binary system.
  199.  
  200. Kent Sandvik
  201. ..not speaking for any company....
  202.  
  203.  
  204.  
  205. ---------------------------
  206.  
  207. Subject: Dropping Aliases on Applications
  208. From: news@massey.ac.nz (USENET News System)
  209. Date: Sun, 16 Feb 1992 21:06:10 GMT
  210. Organization: School of Maths & Info. Sci., Massey University, Palmerston North, NZ
  211.  
  212.  
  213. When a file is dropped on an application the finder resolves any
  214. aliases BEFORE passing the file to the application in the AE message.
  215. This stops you writing an application which deals with alises
  216. themselves - witness all the trash utilities which delete the file the
  217. alias refers to instead of the alias itself :-(.  Two questions:
  218.  
  219. 1) Anybody know how to drop aliases without them being resolved?
  220.  
  221. 2) If not, I think System 7.1 should have a SIZE bit which says an
  222. application accepts aliases. Do you agree/disagree? Email and if
  223. theres a call I'll summarize.
  224.  
  225. Thanks in advance,
  226.             Nigel
  227.  
  228. -- 
  229. - -
  230. Dr Nigel Perry                    Email: N.Perry@massey.ac.nz
  231. Department of Computer Science    Tel: +64 6 356 9099 ext 8900
  232. Massey University                 Fax: +64 6 350 5611
  233. Palmerston North
  234. New Zealand
  235.  
  236.  
  237.  
  238. - -------------------------
  239.  
  240. From: dawg6844@uxa.cso.uiuc.edu (Dan Walkowski)
  241. Subject: >Dropping Aliases on Applications
  242. Date: 19 Feb 92 16:15:48 GMT
  243. Organization: University of Illinois at Urbana
  244.  
  245. Mr. Perry states:
  246.  
  247. When a file is dropped on an application the finder resolves any
  248. aliases BEFORE passing the file to the application in the AE message.
  249. This stops you writing an application which deals with alises
  250. themselves - witness all the trash utilities which delete the file the
  251. alias refers to instead of the alias itself :-(.  Two questions:
  252.  
  253.  
  254. - --
  255. I just wanted to point out that this is NOT the case with TrashMan, which 
  256. does not handle trash in this manner.  TrashMan deals with aliases correctly.
  257.  
  258. Dan Walkowski
  259. -- 
  260. Dan Walkowski  
  261. Univ. of Illinois
  262. walkowsk@cs.uiuc.edu
  263.  
  264.  
  265.  
  266. ---------------------------
  267.  
  268. From: scott@mcl.mcl.ucsb.edu (Scott Bronson)
  269. Subject: Searching though a folder within the system folder
  270. Date: 17 Feb 92 03:59:08 GMT
  271.  
  272. This seems like such an easy file system queston that it must be readily
  273. apparent or in a FAQ somewhere.  However, it wasn't obvious to me, and
  274. I couldn't find it in any csmp FAQs.  Help!
  275.  
  276. I want to keep a folder inside the system folder for the user to be able
  277. to drop files.  I want to be able to PBCatSearch of PBFileSearch through
  278. this folder (which will always have the same name) to find out the name,
  279. file type, and file creator of all the files in there.
  280.  
  281. I haven't figured out how to get a directory ID of this folder.  I tried
  282. getting the VRefNum of the system folder from SysEnvirons, then passing
  283. this and the path ":Token Folder:" to PBCatSearch in the hopes that it
  284. would return a directory ID.  No such luck.  NSVErr (No Such Volume).
  285.  
  286. Is there any standard or accepted way of doing this?  Does anyone have any
  287. type of source code I can see to get it to work?  I'll even take PL/1 or
  288. COBOL if you have it--just so long as it works!  I am REALLY frustrated
  289. that such an easy problem is so hard for me to solve.
  290.  
  291. Thanks for any help you might be able to offer.  You just may save the life
  292. of my poor Macintosh before I hurl it out the 10th floor window if it returns
  293. another one of those $#&%! NSVErrs.  Seriously, thanks for any ideas at all.
  294.  
  295.  
  296.    - Scott            +----------------: SCOTT BRONSON :-----------------+
  297. +---------------------|  scott@mcl.ucsb.edu    2025sbsb@ucsbuxa.ucsb.edu |
  298. | Programming in C is | 6850 El Colegio Road #234; Goleta, CA 93117-4300 |
  299. | glissading indoors. +==================================================+
  300. +=========================+
  301.  
  302.  
  303.  
  304. - -------------------------
  305.  
  306. From: grobbins@Apple.COM (Grobbins)
  307. Subject:  Searching though a folder within the system folder
  308. Date: 18 Feb 92 04:31:13 GMT
  309. Organization: DTS
  310.  
  311. In article <scott.698299148@mcl> scott@mcl.mcl.ucsb.edu (Scott Bronson) writes:
  312. >I want to keep a folder inside the system folder for the user to be able
  313. >to drop files.  I want to be able to PBCatSearch of PBFileSearch through
  314. >this folder (which will always have the same name) to find out the name,
  315. >file type, and file creator of all the files in there.
  316.  
  317. Code below.
  318.  
  319. >I haven't figured out how to get a directory ID of this folder.  I tried
  320. >getting the VRefNum of the system folder from SysEnvirons, then passing
  321. >this and the path ":Token Folder:" to PBCatSearch in the hopes that it
  322. >would return a directory ID.  No such luck.  NSVErr (No Such Volume).
  323.  
  324. Gack.  SysEnvirons returns a WDRefNum, not a VRefNum, and you shouldn't
  325. need to use partial pathnames at all.
  326.  
  327. >This seems like such an easy file system queston that it must be readily
  328. >apparent or in a FAQ somewhere.
  329.  
  330. There are no easy file system questions.  There are, however, Tech Notes
  331. nobody's ever seen...
  332.  
  333.  
  334. Grobbins             grobbins@apple.com
  335.  
  336. Usual disclaimers apply
  337.  
  338. - ------
  339.  
  340.  
  341. PROGRAM GetSystemSubfolder;
  342. USES Files, Folders;
  343. CONST kMyFolderName = 'Special Place';
  344. VAR
  345.   sysVRefNum: INTEGER;
  346.   sysDirID, myFolderDirID: LONGINT;
  347.   retCode: OSErr;
  348.   nameStr: Str255;
  349.   myCInfoPBRec: CInfoPBRec;
  350.   myHPB: HParamBlockRec;
  351.   i: INTEGER;
  352. BEGIN
  353.   { find System folder -- with MPW or Think glue, this works 
  354.      under System 6 too }
  355.   retCode := FindFolder(kOnSystemDisk, kSystemFolderType, FALSE,
  356.     sysVRefNum, sysDirID);  { Inside Mac VI chapter 9 }
  357.     
  358.   IF retCode <> noErr THEN WriteLn('FindFolder returned error ', retCode)
  359.   ELSE
  360.     BEGIN
  361.       { find dirID of my folder in the system folder }
  362.       nameStr := kMyFolderName;
  363.       WITH myCInfoPBRec DO
  364.         BEGIN
  365.           ioCompletion := NIL;
  366.           ioNamePtr := @nameStr;
  367.           ioVRefNum := sysVRefNum;
  368.           ioDrDirID := sysDirID;
  369.           ioFDirIndex := 0;
  370.           ioFVersNum := 0; { MFS compatibility, per Tech Note 204 }
  371.         END;
  372.       retCode := PBGetCatInfoSync(@myCInfoPBRec); { Inside Mac IV chapter 19 }
  373.       
  374.       IF retCode <> noErr THEN WriteLn('PBGetCatInfo returned error', retCode)
  375.       ELSE IF NOT BTst(myCInfoPBRec.ioFlAttrib, 4) THEN { Inside Mac IV-125 }
  376.         WriteLn(kMyFolderName, ' is not a folder')
  377.       ELSE
  378.         BEGIN
  379.           { index through all files in the folder; to index through all
  380.             folders & files in the folder, use PBGetCatInfo instead of
  381.             PBHGetFInfo }
  382.           myFolderDirID := myCInfoPBRec.ioDrDirID;
  383.           i := 0;
  384.           REPEAT
  385.             i := i + 1;
  386.             nameStr := '';
  387.             WITH myHPB DO
  388.               BEGIN
  389.                 ioCompletion := NIL;
  390.                 ioNamePtr := @nameStr;
  391.                 ioVRefNum := sysVRefNum;
  392.                 ioDirID := myFolderDirID;
  393.                 ioFDirIndex := i;
  394.               END;
  395.             retCode := PBHGetFInfoSync(@myHPB);
  396.             IF retCode = noErr THEN
  397.               WITH myHPB DO
  398.                 WriteLn(nameStr, '  type:', ioFlFndrInfo.fdType);
  399.           UNTIL retCode <> noErr;
  400.         END;
  401.     END
  402. END.
  403.  
  404.  
  405.  
  406. - -------------------------
  407.  
  408. From: scott@mcl.mcl.ucsb.edu (Scott Bronson)
  409. Subject:  Searching though a folder within the system folder
  410. Date: 19 Feb 92 06:52:35 GMT
  411.  
  412. In <scott.698299148@mcl> scott@mcl.mcl.ucsb.edu (Scott Bronson) writes:
  413.  
  414. >I want to keep a folder inside the system folder for the user to be able
  415. >to drop files.  I want to be able to PBCatSearch of PBFileSearch through
  416. >this folder (which will always have the same name) to find out the name,
  417. >file type, and file creator of all the files in there.
  418.  
  419. Sorry, I meant to say PBGetCatInfo or PBGetFileInfo.  I did use the
  420. correct routines in my program--honest!  Just didn't remember the
  421. correct names.  (duh..)
  422.  
  423.     - Scott
  424.  
  425.  
  426.  
  427. ---------------------------
  428.  
  429. From: taihou@iss.nus.sg (Tng Tai Hou)
  430. Subject: Hellcats of the Pacific and Fast Graphics
  431. Date: 17 Feb 92 10:20:37 GMT
  432. Organization: Institute of Systems Science, NUS, Singapore
  433.  
  434. I have just wowed my colleagues by running HotP full screen
  435. on my old RasterOps 224 (1024x768x8bits, also 4bits and 1bit).
  436. The speed of the polygon fills is fantastic. But even more
  437. amazing is the full screen update. One has to see it to believe it.
  438.  
  439. Now this is more motivation for by passing Quickdraw and perhaps
  440. even CopyBits, both of which I assume is what Eric Parker, the author,
  441. chose to do. Now to diassemble the program ... Hope I am
  442. not violating anything.
  443.  
  444. Tai Hou
  445. Singapore
  446.  
  447.  
  448.  
  449. - -------------------------
  450.  
  451. From: steveh@tasman.cc.utas.edu.au (Steve Howell)
  452. Subject:  Hellcats of the Pacific and Fast Graphics
  453. Date: 17 Feb 92 12:41:48 GMT
  454. Organization: University of Tasmania, Australia.
  455.  
  456. taihou@iss.nus.sg (Tng Tai Hou) writes:
  457.  
  458. >Now this is more motivation for by passing Quickdraw and perhaps
  459. >even CopyBits, both of which I assume is what Eric Parker, the author,
  460. >chose to do. Now to diassemble the program ... Hope I am
  461. >not violating anything.
  462.  
  463.  
  464.   Why don't you ask the author? He posts regularly on rec.mac.games and
  465. seems perfectly willing to answer peoples questions.
  466.  
  467.  
  468.  
  469. - -------------------------
  470.  
  471. From: jmunkki@hila.hut.fi (Juri Munkki)
  472. Subject:  Hellcats of the Pacific and Fast Graphics
  473. Date: 17 Feb 92 13:59:46 GMT
  474. Organization: Helsinki University of Technology, Finland
  475.  
  476. In article <1992Feb17.102037.15421@nuscc.nus.sg> taihou@iss.nus.sg (Tng Tai Hou) writes:
  477. >Now this is more motivation for by passing Quickdraw and perhaps
  478. >even CopyBits, both of which I assume is what Eric Parker, the author,
  479. >chose to do. Now to diassemble the program ... Hope I am
  480. >not violating anything.
  481.  
  482. I haven't looked at the code, but I've seen the game and I have a few
  483. guesses as to how it works.
  484.  
  485. Hellcats doesn't do full screen updates. It only draws those areas that
  486. have changed. This is something that MS Flight Simulator also used to
  487. do and probably does even today. Video memory is so slow that it pays
  488. to avoid unnecessary reads and writes to and from it.
  489.  
  490. The game probably keeps a vaguely region-like structure of what is
  491. currently displayed on the screen. It can then create a similar
  492. structure for what it wants to display as the next frame. The last
  493. step is to draw the differences.
  494.  
  495. Only the drawing portion is bit-depth dependent, so its pretty easy
  496. to support all bit depths. As long as the frames do not change too
  497. much, the drawing speed remains good. The real trick in the drawing
  498. routines is in optimizing the drawing code for horizontal line segments.
  499. It's a lot like drawing a region.
  500.  
  501. Before you have the frame description, you have to scan-convert the
  502. polygons. This is covered in many computer graphics books and has
  503. really nothing to do with the Macintosh in specific. It's quite tricky
  504. to write a fast scan converter that simultaneously draws multiple
  505. polygons that have been sorted by priority (visibility).
  506.  
  507. Hellcats cheats a lot in the priority calculations. It probably does
  508. backface culling and then uses a quick and dirty algorithm to sort the
  509. remaining polygons. You can see the errors if you fly into an aircraft
  510. carrier.
  511.  
  512. Still, I didn't think that this method would be fast enough for interesting
  513. games, so I've never tried to write something like this. Apparently the
  514. current Macs are fast enough or my guesses are totally wrong.
  515.  
  516. IMO, there's money to be made by writing a series of totally different
  517. simulators (different planes and settings, some from reality, some fantasy
  518. themes and a few science fiction games) instead of making more scenarios
  519. for the current Hellcats simulator. Scenarios will not appeal to the wide
  520. audience. New games are always more appealing.
  521.  
  522.    ____________________________________________________________________________
  523.   / Juri Munkki        /  Helsinki University of Technology   /  Wind  / Project /
  524.  / jmunkki@hut.fi  /  Computing Center Macintosh Support  /  Surf  / Arashi  /
  525.  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  526.  
  527.  
  528.  
  529. - -------------------------
  530.  
  531. From: steveh@tasman.cc.utas.edu.au (Steve Howell)
  532. Subject:  Hellcats of the Pacific and Fast Graphics
  533. Date: 18 Feb 92 05:44:02 GMT
  534. Organization: University of Tasmania, Australia.
  535.  
  536. steveh@tasman.cc.utas.edu.au (Steve Howell) writes:
  537.  
  538. >taihou@iss.nus.sg (Tng Tai Hou) writes:
  539.  
  540.  
  541. >  Why don't you ask the author? He posts regularly on rec.mac.games and
  542. >seems perfectly willing to answer peoples questions.
  543.  
  544.  
  545.   Oops.. of course, that should be "comp.sys.mac.games". Sorry...
  546.  
  547.  
  548.  
  549. ---------------------------
  550.  
  551. From: overeind@fwi.uva.nl (Benno Overeinder)
  552. Subject: Think C 4.0 Debugger and System 7
  553. Date: 17 Feb 92 11:17:45 GMT
  554. Organization: FWI, University of Amsterdam
  555.  
  556. This may be a stupid question, but it will be clear I am new to Think C and 
  557. System 7.
  558.  
  559. I was reading the Bullseye tutorial in the Think C Guide and at the same
  560. time playing with Think C 4.0. Running the Bullseye project with the source
  561. level debugger on, resulted in a system error. The two windows of the 
  562. debugger appeared on the monitor, but none of the two was active, neither 
  563. any other window on the monitor was. It was not possible to activate any 
  564. window and the only solution was to reset my Mac. I have tried it several 
  565. times, mostly followed by the scenario described above, but once I read 
  566. an error message in the source level debugger saying that a bus error 
  567. appeared.
  568.  
  569. Does anyone recognize this? Thank you in advance,
  570.  
  571.   -- Benno
  572. -- 
  573. ===========================================================================
  574.  Benno Overeinder             Computer Systems Department         
  575.                       University of Amsterdam        
  576.  e-mail: overeind@fwi.uva.nl         The Netherlands
  577.  
  578.  
  579.  
  580. - -------------------------
  581.  
  582. From: 8888cc19@uhdvx3.dt.uh.edu (Saltgirl)
  583. Subject:  Think C 4.0 Debugger and System 7
  584. Date: 18 Feb 92 19:36:00 GMT
  585. Organization: University of Houston-Downtown
  586.  
  587. >I was reading the Bullseye tutorial in the Think C Guide and at the same
  588. >time playing with Think C 4.0. Running the Bullseye project with the source
  589. >level debugger on, resulted in a system error. The two windows of the 
  590. >debugger appeared on the monitor, but none of the two was active, neither 
  591. >any other window on the monitor was. It was not possible to activate any 
  592. >window and the only solution was to reset my Mac. I have tried it several 
  593. >times, mostly followed by the scenario described above, but once I read 
  594. >an error message in the source level debugger saying that a bus error 
  595. >appeared.
  596. >Does anyone recognize this? Thank you in advance,
  597.  
  598.     Try turning Virtual Memory off if it is on....
  599.     I have seen this same thing happen with projects of mine.
  600.     It has to do with VM using bus errors (read the chapter on 
  601.     VM in IM-IV)
  602.  
  603.     Tina Femea
  604.     8888cc19@dt3.dt.uh.edu
  605.     
  606.  
  607.  
  608.  
  609. ---------------------------
  610.  
  611. From: liran@bimacs.BITNET (Eshel Liran)
  612. Subject: Asynchronious Sound Recording
  613. Date: 17 Feb 92 13:02:25 GMT
  614. Organization: Math & CS, BarIlan U, Ramat-Gan, Israel
  615.  
  616. Is asynchronious sound recording possible ?
  617. I want to be able to access the recorded information during the time it arrives
  618. any ideas ? is it possible using the current sound driver ?
  619. any sample codes avaliable ?
  620.  
  621.       Liran Eshel
  622.   Bar-Ilan University,
  623.    Ramat-Gan, ISRAEL
  624. liran@bimacs.cs.biu.ac.il
  625.  
  626.  
  627.  
  628. - -------------------------
  629.  
  630. From: REEKES@applelink.apple.com (Jim Reekes)
  631. Subject:  Asynchronious Sound Recording
  632. Date: 18 Feb 92 21:07:26 GMT
  633. Organization: Apple Computer, Inc.
  634.  
  635. In article <3771@bimacs.BITNET>, liran@bimacs.BITNET (Eshel Liran) writes:
  636. > Is asynchronious sound recording possible ?
  637. > I want to be able to access the recorded information during the time it arrives
  638. > any ideas ? is it possible using the current sound driver ?
  639. > any sample codes avaliable ?
  640.  
  641. Yes, and it's all documented in Inside Mac VI - The Sound Manager.
  642.  
  643. The MacRecorder input driver is NOT asynchronious, but all Macs with 
  644. built-in sound input will.
  645.  
  646.  
  647. - -----------------------------------------------------------------
  648. Jim Reekes, E.O.             |     Macintosh Toolbox Engineering
  649.                              |          Sound Manager Expert
  650. Apple Computer, Inc.         | All opinions expressed are mine, and
  651. 20525 Mariani Ave. MS: 81-EQ |  do not necessarily represent those
  652. Cupertino, CA 95014          |  of my employer, Apple Computer Inc.
  653.  
  654.  
  655.  
  656. ---------------------------
  657.  
  658. From: asunta@convex.csc.FI (Miika Asunta)
  659. Subject: Temporary file name suggestion
  660. Date: 17 Feb 92 17:17:41 GMT
  661. Organization: Finnish Academic and Research Network Project - FUNET
  662.  
  663.  
  664. Since it's easy to create conflicting names for temporary files
  665. I suggest that every piece of code should use its four character 
  666. creator-code converted to a long integer as filename, and if there 
  667. is need for additional file names, the code would add _<number>
  668. at the end of the name.
  669.  
  670. Example:
  671. ====================================================
  672.  
  673. Creator:        'ABCD'
  674. Converted to long:    1094861636
  675.  
  676. Suggested Temporary filenamestring:     1094861636
  677. Additional file names:            1094861636_0
  678.                     1094861636_1
  679.                     1094861636_2
  680.                     1094861636_3
  681.                     .
  682.                     .
  683.                     .
  684.                     1094861636_n
  685.  
  686. ====================================================
  687.  
  688. Some programs just use TickCount() to create Temporary file names,
  689. I think this technique is more sophisticated and quarantees
  690. unique filenames, anyway you need still check for conflicts, a user
  691. might be running your code twice.
  692.  
  693. And last, the existence of a file can easily be checked with
  694. FSMakeFSSpec() routine.
  695.  
  696. Miika Asunta
  697. --
  698. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  699. &  Miika Asunta        &  asunta@convex.csc.fi  &  Double Bass Player   &
  700. & tel. +358-0-494 093  &             &  Macintosh Programmer &
  701. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  702.  
  703.  
  704.  
  705. - -------------------------
  706.  
  707. From: neeri@iis.ethz.ch (Matthias Ulrich Neeracher)
  708. Subject:  Temporary file name suggestion
  709. Date: 18 Feb 92 18:53:25 GMT
  710. Organization: Integrated Systems Laboratory, ETH, Zurich
  711.  
  712. In article <1992Feb17.171741.11289@nic.funet.fi> asunta@convex.csc.FI (Miika Asunta) writes:
  713. >Since it's easy to create conflicting names for temporary files
  714. >I suggest that every piece of code should use its four character 
  715. >creator-code converted to a long integer as filename, and if there 
  716. >is need for additional file names, the code would add _<number>
  717. >at the end of the name.
  718. >
  719. >Example:
  720. >====================================================
  721. >
  722. >Creator:        'ABCD'
  723. >Converted to long:    1094861636
  724. >
  725. >Suggested Temporary filenamestring:     1094861636
  726. >Additional file names:            1094861636_0
  727. >                    1094861636_1
  728. >                    1094861636_2
  729. >                    1094861636_3
  730. >                    .
  731. >                    .
  732. >                    .
  733. >                    1094861636_n
  734.  
  735. I think no program should rely on *any* filenames not being used yet. *Any*
  736. temporary file name you pick should be checked for uniqueness. And once you
  737. have decided to do that, I see no need to agree on a particular filename
  738. pattern between programmers (Your solution is unambiguous, but it's very hard
  739. to find out for humans which filenames belong to which application. Personally,
  740. I prefer to have temporary filenames of the form MyApp00014).
  741.  
  742. Matthias
  743.  
  744. - ---
  745. Matthias Neeracher                                   neeri@iis.ethz.ch
  746.    "Your hurricane will be God's signature" -- Blue Aeroplanes
  747.  
  748.  
  749.  
  750. ---------------------------
  751.  
  752. From: eyal@vis.toronto.edu
  753. Subject: PICT <-> Raw
  754. Date: 17 Feb 92 19:14:57 GMT
  755. Organization: Department of Computer Science, University of Toronto
  756.  
  757.  
  758. Hi,
  759. I'm in need of an application that will let me convert back and forth
  760. between PICT format images and raw bit images. I want to make use of 
  761. Mac drawing programs on the one hand and write various image processing
  762. routines of my own.  
  763. I know i'm being lazy (not writing up the two routines) but I'm sure 
  764. someone out there has done this before, and it seems a waste of time
  765. to "reinvent the wheel".
  766. I would greatly appreciate any kind of help ...
  767.  
  768. thanx in advance, eyal
  769.  
  770.  
  771.  
  772. - -------------------------
  773.  
  774. From: russotto@eng.umd.edu (Matthew T. Russotto)
  775. Subject:  PICT <-> Raw
  776. Date: Mon, 17 Feb 92 20:30:40 GMT
  777. Organization: University of Maryland, College Park, College of Engineering
  778.  
  779. In article <92Feb17.141415est.8861@orasis.vis.toronto.edu> eyal@vis.toronto.edu writes:
  780. >
  781. >Hi,
  782. >I'm in need of an application that will let me convert back and forth
  783. >between PICT format images and raw bit images. I want to make use of 
  784. >Mac drawing programs on the one hand and write various image processing
  785. >routines of my own.  
  786. >I know i'm being lazy (not writing up the two routines) but I'm sure 
  787. >someone out there has done this before, and it seems a waste of time
  788. >to "reinvent the wheel".
  789. >I would greatly appreciate any kind of help ...
  790.  
  791. If you can find an old version of Wayne Rasband's Image program, it saves in
  792. a format which is near-raw (it has a header, but is otherwise raw).  Newer
  793. versions save in TIFF.
  794.  
  795. It is rather big for image-conversion, though....
  796. -- 
  797. Matthew T. Russotto    russotto@eng.umd.edu    russotto@wam.umd.edu
  798. Your superior intellect is no match for our puny weapons! -- The Simpsons
  799. Just say NO to police searches and seizures.  Make them use force.
  800. (not responsible for bodily harm resulting from following above advice)
  801.  
  802.  
  803.  
  804. - -------------------------
  805.  
  806. From: Carl.Constantine@BCSystems.GOV.BC.CA
  807. Subject:  PICT <-> Raw
  808. Date: 19 Feb 92 07:44:48 -0800
  809. Organization: BC Systems Corporation
  810.  
  811. In article <92Feb17.141415est.8861@orasis.vis.toronto.edu>, eyal@vis.toronto.edu writes:
  812. > Hi,
  813. > I'm in need of an application that will let me convert back and forth
  814. > between PICT format images and raw bit images. I want to make use of 
  815. > Mac drawing programs on the one hand and write various image processing
  816. > routines of my own.  
  817. > I know i'm being lazy (not writing up the two routines) but I'm sure 
  818. > someone out there has done this before, and it seems a waste of time
  819. > to "reinvent the wheel".
  820. > I would greatly appreciate any kind of help ...
  821.  
  822. Look at SuperPaint 3.0.  It has a function for "cutting to draw/paint" layers
  823. which allows you to take a bitmapped image, cut to draw, then manuipulate it
  824. like a PICT and vise versa.  Or you can take a bitmap and "TRACE" it to the
  825. Draw layer.  I know SuperPaint 2.0 did this and I would assume that 3.0 does as
  826. well (I haven't ordered my upgrade yet).
  827.  
  828. -- 
  829. Carl.Constantine@BCSystems.gov.bc.ca
  830. Victoria, British Columbia, Canada
  831.  
  832.  
  833.  
  834.  
  835. ---------------------------
  836.  
  837. From: n8541751@henson.cc.wwu.edu (Where there is darkness, light)
  838. Subject: Detecting color hardware
  839. Date: 18 Feb 92 01:35:10 GMT
  840. Organization: Monkey Tree Computer Services
  841.  
  842. Can anyone tell me if there's an easy way for an application to tell if
  843. a mac has color hardware?
  844.  
  845. The Inside Macintosh books show how to detect Color Quickdraw, but are very
  846. vague when it comes to detecting the type of hardware.
  847.  
  848. Thanks,
  849.  
  850. Kris Bruland
  851.  
  852. -- 
  853. Kriston M. Bruland          |    . .         . .      . . .      .       . .
  854. n8541751@henson.cc.wwu.edu  |    .   .     . .        .        . .       .   .
  855. 8541751@nessie.cc.wwu.edu   |    .             .         .     .   .     .
  856.  
  857.  
  858.  
  859. - -------------------------
  860.  
  861. From: deadman@garnet.berkeley.edu (Ben Haller)
  862. Subject:  Detecting color hardware
  863. Date: 18 Feb 92 10:36:07 GMT
  864. Organization: Stick Software
  865.  
  866. In article <1992Feb18.013510.26641@henson.cc.wwu.edu>
  867.   n8541751@henson.cc.wwu.edu (Where there is darkness, light) writes:
  868. >Can anyone tell me if there's an easy way for an application to tell if
  869. >a mac has color hardware?
  870. >
  871. >The Inside Macintosh books show how to detect Color Quickdraw, but are very
  872. >vague when it comes to detecting the type of hardware.
  873.  
  874. If color QuickDraw is available, then you may use the color calls, and if
  875. you're actually running in black and white, the colors will be translated
  876. down to the 1-bit color table.  And of course if color QuickDraw is not
  877. available, then you are guaranteed not to have any color hardware,
  878. basically (there are a few monitors that use the original QuickDraw fgColor
  879. and backColor, I think, but you really needn't worry about that unless you
  880. want to...)  So you don't *have* to know whether you are in color or not,
  881. you *can* switch based only on the availability of Color QuickDraw.
  882.   Of course, since QuickDraw does such a poor job of doing color graphics
  883. in 1-bit mode (using solid black or white instead of dither patterns, etc.)
  884. usually it is best to figure out the bit depths of the various monitors on
  885. the system, and change your drawing code to adapt to the environment.  For
  886. this, use the GDevice manager, right next to Color QuickDraw in IM V.  In
  887. many cases you need to loop over all attached monitors and draw separately
  888. on each one, setting the clipping so you only draw to that monitor.  Then
  889. your graphics will look optimal even if they bridge multiple monitors.
  890. It's a bit of trouble, but not too bad if you design your code correctly.
  891. And it looks really cool.
  892.   As to your exact question (which I haven't yet answered because I suspect
  893. it's not what you *really* meant), you can find out what hardware a machine
  894. has by talking to each GDevice's driver.  The refNum of the driver is
  895. stored inside the GDevice record.  If you get the book "Designing Cards
  896. And Drivers for the Macintosh II and Macintosh SE" (I think that's the
  897. title) it will tell you how to ask the driver what the name of the card is,
  898. what bit depths it is capable of running in, etc.  However, *very* few
  899. programs need to do this.  You should generally accept the environment
  900. you're given, don't go switching bit depths and funky stuff like that.
  901.  
  902. -Ben Haller (deadman@garnet.berkeley.edu)
  903. "What was the question? ... I was looking at the Big Sky..." - KT
  904.  
  905.  
  906.  
  907. - -------------------------
  908.  
  909. From: tagreen@bronze.ucs.indiana.edu (Todd Green)
  910. Subject:  Detecting color hardware
  911. Organization: Indiana University
  912. Date: Tue, 18 Feb 92 13:23:51 GMT
  913.  
  914.  
  915. >In article <1992Feb18.013510.26641@henson.cc.wwu.edu> writes:
  916. >>
  917. >>The Inside Macintosh books show how to detect Color Quickdraw, but are very
  918. >>vague when it comes to detecting the type of hardware.
  919. >
  920. > [Ben's long description deleted]
  921.  
  922. Just in case you were interested in simply finding out whether or not
  923. the machine was set to "Grays" or "Color" and the bit depth, here are
  924. two simple routines that will do it for you.  (Of course you'll need
  925. to call these multiple times, once for each monitor)
  926.  
  927. short GetDeviceDepth(GDHandle grafDevice)
  928. {
  929.     return((**(**grafDevice).gdPMap).pixelSize);
  930. }
  931.  
  932. Boolean    IsMono(GDHandle grafDevice)
  933. {
  934.     return((!TestDeviceAttribute(grafDevice, gdDevType)));
  935. }
  936.  
  937. Todd
  938. -- 
  939. Internet: tagreen@bronze.ucs.indiana.edu
  940. NeXTMail: tagreen@cheyenne.ucs.indiana.edu
  941. BitNet:   tagreen@iubacs.bitnet
  942.  
  943.  
  944.  
  945. ---------------------------
  946.  
  947. Subject: Floating point registers contents to main memory?
  948. From: russells@ccu1.aukuni.ac.nz (Russell Street)
  949. Date: Tue, 18 Feb 1992 03:50:07 GMT
  950. Organization: University of Auckland, New Zealand.
  951.  
  952. How do I move the contents of the floating point registers
  953. (fp0 etc ) into a variable etc?
  954.  
  955. I thought
  956.     fmove.x fp0, (a0)
  957. would do it (with a0 pointing to a suitable storage space).
  958. But when you go back the other way the result in fp0 not 
  959. correct.
  960.  
  961. I can not easily see what I should be doing from the
  962. book of the 68000 family I have.
  963.  
  964.  
  965.  
  966. Thanks in advance...
  967. - ------------------------------------------------------------
  968. Russell Street (russells@ccu1.aukuni.ac.nz)
  969.  
  970. Had you been alive at 3 am on the third of Autumn and switched
  971. on your wireless you would have heard this:
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986. - -------------------------
  987.  
  988. From: lstein@athena.mit.edu (Lincoln Stein)
  989. Subject:  Floating point registers contents to main memory?
  990. Date: 19 Feb 92 03:04:55 GMT
  991. Organization: Massachusetts Institute of Technology
  992.  
  993. FMOVE.X FP0,(A0) will indeed move an extended format float into memory
  994. at the address stored in A0.  
  995.  
  996. FMOVE.X (A0),FP0 does the reverse.
  997.  
  998. You should be aware, if you are not already, that the extended format
  999. float used by the 68881/68882 coprocessor is NOT the same as that used
  1000. by Apple's SANE.  Specifically, the 68881/2 format is a 12-byte
  1001. format, while the SANE format is 10 bytes.  If you are using a
  1002. high-level language as the front end of your floating point code, be
  1003. sure to tell the compiler to save storage for coprocessor-format
  1004. extendeds rather than SANE extendeds.  Reals and Doubles (4 and 8
  1005. bytes respectively) are always safe to use, since their 68881/2 and
  1006. SANE formats are the same.
  1007.  
  1008. I hope this helps.
  1009.  
  1010. - --------------------------------------------------------------------------
  1011. Lincoln Stein                Brigham & Women's Hospital, Boston
  1012. lstein@hstbme.mit.edu
  1013. - --------------------------------------------------------------------------
  1014.  
  1015.  
  1016.  
  1017.  
  1018. - -------------------------
  1019.  
  1020. Subject:  Floating point registers contents to main memory?
  1021. From: russells@ccu1.aukuni.ac.nz (Russell Street)
  1022. Date: Thu, 20 Feb 1992 00:50:50 GMT
  1023. Organization: University of Auckland, New Zealand.
  1024.  
  1025. lstein@athena.mit.edu (Lincoln Stein) writes:
  1026.  
  1027. >FMOVE.X FP0,(A0) will indeed move an extended format float into memory
  1028. >at the address stored in A0.  
  1029.  
  1030. >FMOVE.X (A0),FP0 does the reverse.
  1031.  
  1032. My trouble was that I used "movea.l arrayOf12Chars, a0" instead
  1033. of "lea arrayOf12Chars, a0" so a0 was not pointing to anywhere
  1034. sensible!  After fixing that things work just great.
  1035.  
  1036.  
  1037. - ------------------------------------------------------------
  1038. Russell Street (russells@ccu1.aukuni.ac.nz)
  1039.     "Thank you for your support -- I shall always wear it!"
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047. ---------------------------
  1048.  
  1049. From: bmor@kimbark.uchicago.edu (brad  morris)
  1050. Subject: TN #120 and Non-32 Bit QD
  1051. Date: 18 Feb 92 05:52:55 GMT
  1052. Organization: University of Chicago Computing Organizations
  1053.  
  1054. Well, I am using the code with some minor mods from tech note #120 to create
  1055. an off screen pixmap.  Seems to work fine on IIci (7.0, 6.0.5), IIsi (6.0.7),
  1056. and IIfx (7.0.1).  But on a IIcx (6.0.5), the copy bits seems to only be
  1057. copying one pixel of depth.  I am going to try to install the 32 bit QD init
  1058. and see if that helps, but I am at a loss as to why the code would do this.  A
  1059. quick check of IMV says that the copy bits routine should recognize what is
  1060. passed to it by the portVersion field.  And this is set the same way with or
  1061. without 32 bit QD, no?  It should be set by _OpenCPort, right?   
  1062.                                                                        
  1063. What is the problem?  Anyone have a clue?  Could this be unrelated to 32
  1064. bit QD and simply be a weird init conflict or something?
  1065.                  
  1066. And what is a quick way to find out if 32 bit QD is availible if using Think 5
  1067. and no Gestalt glue is availible?                 
  1068.  
  1069. Thanks all.
  1070.  
  1071. Brad Morris
  1072.  
  1073.  
  1074.  
  1075. - -------------------------
  1076.  
  1077. From: bmor@kimbark.uchicago.edu (brad  morris)
  1078. Subject:  TN #120 and Non-32 Bit QD
  1079. Date: 19 Feb 92 22:24:28 GMT
  1080. Organization: University of Chicago Computing Organizations
  1081.  
  1082. All right.  I have found out more.  First, it is a problem of not having
  1083. 32 Bit QD.  When 32 Bit QD is installed on the Mac IIcx, everything is
  1084. fine.  Second, it is not a palette conversion problem, because I tried
  1085. to copy the palette to a clut and got the same result.  I am sure that
  1086. it is drawing the right bit map, and that the off screen port is a
  1087. color port and not a bit map.  And I am sure that the upper two bits
  1088. of the portVersion are set as they should be.  Furthermore, I looked
  1089. at the pict that was being drawn into the off screen bitmap on the
  1090. IIcx without 32 Bit QD and it was fine (the colors were there).  
  1091. What I don't know about is what Apple's code in TN #120 does when it
  1092. sets up the GDevice.  The other real problem is that development is
  1093. done on a IIci that has 32 Bit QD in ROM, so there is no way to simulate
  1094. the problem on the development machine.
  1095.  
  1096. I have considered disabling color if 32 Bit QD is not available, but then
  1097. what is the point of creating my own offscreen pixmaps anyway.  I mean,
  1098. I should just scrap the thing and use a GWorld.
  1099.  
  1100. I am pretty desperate.  Does anyone out there know anything about this
  1101. stuff?
  1102.  
  1103. Pulling my hair out one by one...
  1104.  
  1105. Brad Morris
  1106.  
  1107.  
  1108.  
  1109. ---------------------------
  1110.  
  1111. From: xdaa374@ut-emx.uucp (William T. Douglass)
  1112. Subject: NBP LookUp Problem
  1113. Date: 18 Feb 92 19:28:31 GMT
  1114. Organization: The University of Texas at Austin, Austin, Texas
  1115.  
  1116. I have run into a problem with the following code fragment.  This is from a
  1117. standard module I wrote in Think C to perform NBP lookups. The routine receives
  1118. an EntityName (object, type and zone strings) and a buffer to store the list of
  1119. NVEs found matching that entity name.  It performs the NBP lookup call and
  1120. returns the # of objects found.
  1121.  
  1122. Other programs using this routine work fine, but this time around, the
  1123. NBPSetEntity call seems to go wacko.  The internal buffer used in creating the
  1124. NBP entity structure does not get set.  The NBPSetEntity call either is having
  1125. no effect, or is storing the entity structure in some strange location (not in
  1126. the internal LkUpBuf buffer.)
  1127.  
  1128. I am including the subroutine and the calling code in the hopes that someone
  1129. might see something (stupid or otherwise) that I am overlooking.  Perhaps
  1130. someone has run across this also; any help is appreciated.
  1131.  
  1132. Thx.
  1133.  
  1134. /******************** caller ********************/
  1135. EntityName    Ename;
  1136. char          MyBuffer[500];
  1137.  
  1138. memmove(&Ename.objStr, "\p*", 2);
  1139. memmove(&Ename.typeStr, "\pLaserWriter", 12);
  1140. memmove(&Ename.zoneStr, "\p*", 2);
  1141.  
  1142. /** call lookup procedure **/
  1143. i=NBPLookUpEntity(&Ename, (Ptr) &MyBuffer, sizeof(MyBuffer), 1);
  1144.  
  1145.  
  1146.  
  1147. /******************** NBP Lookup ***********************/
  1148. /** look up given entity name - return list in buffer **/
  1149. /** takes EntityName struct, buffer ptr, buffer size, & # to return **/
  1150. /** returns: >=0 means # entities in buffer           **/
  1151. /**                 <0 means error                    **/
  1152.  
  1153. int NBPLookUpEntity( EntityName *entName, Ptr buffer,
  1154.                            int bufferSize, int maxEnt )
  1155.  
  1156. /* EntityName    *entName   - name to lookup          */
  1157. /* Ptr           buffer     - return name in buffer   */
  1158. /* int           bufferSize - size of buffer          */
  1159. /* int           maxEnt     - max # of name to return */
  1160.  
  1161. {
  1162.  
  1163.  
  1164.         OSErr                   systemError=0;
  1165.         int                     i;
  1166.         char                    *LkUpBuf;
  1167.         MPPParamBlock   LookUpRec;
  1168.  
  1169.         /** build entity structure for lookup call   **/
  1170.         /** find all lw in specified zone      **/
  1171.         LkUpBuf = (char *) malloc(400);
  1172.         NBPSetEntity(LkUpBuf, (*entName).objStr, (*entName).typeStr,
  1173. (*entName).zoneStr);
  1174.  
  1175.         /** set up MPP record for confirm call **/
  1176.         LookUpRec.MPPentityPtr= (Ptr) LkUpBuf;
  1177.         LookUpRec.MPPretBuffPtr=buffer;        /* return buffer */
  1178.         LookUpRec.MPPretBuffSize=bufferSize;
  1179.         LookUpRec.MPPmaxToGet=maxEnt;            /* buffer can hold 5 matches */
  1180.         LookUpRec.MPPinterval=8;               /* about 1 sec (64 ticks) */
  1181.         LookUpRec.MPPcount=2;                  /* 2 tries */
  1182.  
  1183.         /** lookup all NVEs matching this EntityName  **/
  1184.         systemError=PLookupName(&LookUpRec,0); /* synch call */
  1185.         free(LkUpBuf);
  1186.  
  1187.         /** return neg. error code if error occurred **/
  1188.         /** else return # items in buffer **/
  1189.         if (systemError != noErr)
  1190.                 return systemError;
  1191.         else
  1192.                 return LookUpRec.MPPnumGotten;
  1193. }
  1194.  
  1195.  
  1196. -- 
  1197. Bill Douglass, TCADA
  1198.  
  1199. "I dreamed I was to take a test,
  1200.  in a Dairy Queen, on another planet."      L. Anderson
  1201.  
  1202.  
  1203.  
  1204. - -------------------------
  1205.  
  1206. From: liran@bimacs.BITNET (Eshel Liran)
  1207. Subject: NBP Lookup
  1208. Date: 19 Feb 92 12:40:03 GMT
  1209. Organization: Math & CS, BarIlan U, Ramat-Gan, Israel
  1210.  
  1211. When I perform NBP Lookup the search is done using the EntityName, and I must
  1212. specify the size of the reception block.
  1213. What if i get more sockets then the maximum number which i specified ?
  1214. Is there a last flag, like in zone lookup ?
  1215. Is it possible to continue the lookup from where the last request stopped ?
  1216. Is it possible to perform a search according to the nodes IDs ?
  1217. Can I find out the total number of vissible sockets ? if so, how much
  1218. net-traffic does it cost me ?
  1219.  
  1220.       Liran Eshel
  1221.   Bar-Ilan University
  1222.    Ramat-Gan, ISRAEL
  1223. liran@bimacs.cs.biu.ac.il
  1224.  
  1225.  
  1226.  
  1227.  
  1228. ---------------------------
  1229.  
  1230. End of C.S.M.P. Digest
  1231. **********************
  1232.